home *** CD-ROM | disk | FTP | other *** search
- class mx.screens.Slide extends mx.screens.Screen
- {
- var _childSlides;
- var addEventListener;
- static var symbolName = "Slide";
- static var symbolOwner = mx.screens.Slide;
- var className = "Slide";
- var _isSlide = true;
- var _currentChildSlide = null;
- var _currentSlide = null;
- var _indexInParentSlide = -1;
- var _childThatContainsGotoSlide = -1;
- var _defaultKeyDownHandler = null;
- var _shown = false;
- static var _disableArrowKeys = false;
- static var _focusFixup = null;
- static var _gotoSlideNesting = 0;
- var _laterGotoSlide = null;
- static var _inKeyDown = false;
- static var _focusSeq = 0;
- static var _clickFocusSeq = 0;
- var autoKeyNav = "inherit";
- var overlayChildren = false;
- var playHidden = true;
- function Slide()
- {
- super();
- }
- function get currentChildSlide()
- {
- return this._currentChildSlide;
- }
- function get currentSlide()
- {
- return this._currentSlide;
- }
- static function get currentFocusedSlide()
- {
- var curFocus;
- curFocus = _root.focusManager.getFocus();
- if(!curFocus || curFocus == undefined)
- {
- curFocus = eval(Selection.getFocus());
- }
- while(curFocus && !curFocus._isSlide)
- {
- curFocus = curFocus._parent;
- }
- if(curFocus == undefined)
- {
- return null;
- }
- return mx.screens.Slide(curFocus);
- }
- function get defaultKeyDownHandler()
- {
- return this._defaultKeyDownHandler;
- }
- function set defaultKeyDownHandler(newHandler)
- {
- this._defaultKeyDownHandler = newHandler;
- }
- function get firstSlide()
- {
- var _loc2_ = this;
- while(_loc2_.numChildSlides > 0)
- {
- _loc2_ = _loc2_.getChildSlide(0);
- }
- return _loc2_;
- }
- function get lastSlide()
- {
- var _loc2_ = this;
- while(_loc2_.numChildSlides > 0)
- {
- _loc2_ = _loc2_.getChildSlide(_loc2_.numChildSlides - 1);
- }
- return _loc2_;
- }
- function get indexInParentSlide()
- {
- return this._indexInParentSlide;
- }
- function get nextSlide()
- {
- var _loc2_ = this;
- while(true)
- {
- if(!_loc2_.parentIsSlide)
- {
- break;
- }
- if(_loc2_.indexInParentSlide != _loc2_.parentSlide.numChildSlides - 1)
- {
- _loc2_ = _loc2_.parentSlide.getChildSlide(_loc2_.indexInParentSlide + 1);
- break;
- }
- _loc2_ = _loc2_.parentSlide;
- }
- if(!_loc2_.parentIsSlide)
- {
- return null;
- }
- _loc2_ = _loc2_.firstSlide;
- return _loc2_;
- }
- function get numChildSlides()
- {
- return this._childSlides.length;
- }
- function get parentIsSlide()
- {
- return this.parentSlide != null && this.parentSlide._isSlide;
- }
- function get parentSlide()
- {
- var _loc2_ = this._parent;
- while(true)
- {
- if(_loc2_ == null)
- {
- return null;
- }
- if(!_loc2_._isSlideContainer)
- {
- if(_loc2_._isSlide)
- {
- return mx.screens.Slide(_loc2_);
- }
- return null;
- }
- _loc2_ = _loc2_._parent;
- }
- }
- function get previousSlide()
- {
- var _loc2_ = this;
- while(true)
- {
- if(!_loc2_.parentIsSlide)
- {
- break;
- }
- if(_loc2_.indexInParentSlide != 0)
- {
- _loc2_ = _loc2_.parentSlide.getChildSlide(_loc2_.indexInParentSlide - 1);
- break;
- }
- _loc2_ = _loc2_.parentSlide;
- }
- if(!_loc2_.parentIsSlide)
- {
- return null;
- }
- _loc2_ = _loc2_.lastSlide;
- return _loc2_;
- }
- function get rootSlide()
- {
- var _loc2_ = this;
- while(_loc2_.parentIsSlide)
- {
- _loc2_ = _loc2_.parentSlide;
- }
- return _loc2_;
- }
- function getChildSlide(childIndex)
- {
- return this._childSlides[childIndex];
- }
- function gotoFirstSlide()
- {
- if(this.firstSlide == null)
- {
- return false;
- }
- return this.gotoSlide(this.firstSlide);
- }
- function gotoLastSlide()
- {
- if(this.lastSlide == null)
- {
- return false;
- }
- return this.gotoSlide(this.lastSlide);
- }
- function gotoNextSlide()
- {
- if(this.nextSlide == null)
- {
- return false;
- }
- return this.gotoSlide(this.nextSlide);
- }
- function gotoPreviousSlide()
- {
- if(!this.previousSlide)
- {
- return false;
- }
- return this.gotoSlide(this.previousSlide);
- }
- function gotoSlide(newSlide)
- {
- if(mx.screens.Slide._gotoSlideNesting > 0)
- {
- this._laterGotoSlide = newSlide;
- this.doLater(this,"doLaterGotoSlide");
- return false;
- }
- mx.screens.Slide._gotoSlideNesting = mx.screens.Slide._gotoSlideNesting + 1;
- if(newSlide == null)
- {
- mx.screens.Slide._gotoSlideNesting--;
- return false;
- }
- var _loc5_ = newSlide;
- var _loc9_ = 0;
- while(true)
- {
- _loc5_._childThatContainsGotoSlide = _loc9_;
- _loc9_ = _loc5_.indexInParentSlide;
- if(!_loc5_.parentIsSlide)
- {
- break;
- }
- _loc5_ = _loc5_.parentSlide;
- }
- var _loc2_ = null;
- var _loc10_ = null;
- var _loc4_ = undefined;
- if(this.rootSlide.currentSlide == null)
- {
- _loc2_ = this.rootSlide;
- _loc10_ = _loc2_;
- }
- else
- {
- _loc2_ = this.rootSlide.currentSlide;
- _loc10_ = _loc2_;
- while(_loc2_._childThatContainsGotoSlide == -1)
- {
- if(_loc2_.parentIsSlide)
- {
- if(_loc2_.parentSlide._childThatContainsGotoSlide == -1)
- {
- if(_loc2_.shouldHideDuringGoto())
- {
- if(_loc2_.parentSlide.overlayChildren)
- {
- _loc4_ = 0;
- while(_loc4_ <= _loc2_.indexInParentSlide)
- {
- _loc2_.parentSlide.getChildSlide(_loc4_).hideSlide();
- _loc4_ = _loc4_ + 1;
- }
- }
- else
- {
- _loc2_.hideSlide();
- }
- }
- }
- else if(!_loc2_.parentSlide.overlayChildren)
- {
- _loc2_.hideSlide();
- }
- else
- {
- _loc4_ = _loc2_.parentSlide._childThatContainsGotoSlide + 1;
- while(_loc4_ <= _loc2_.indexInParentSlide)
- {
- _loc2_.parentSlide.getChildSlide(_loc4_).hideSlide();
- _loc4_ = _loc4_ + 1;
- }
- }
- }
- if(!_loc2_.parentIsSlide)
- {
- break;
- }
- _loc2_ = _loc2_.parentSlide;
- }
- }
- if(_loc2_._childThatContainsGotoSlide == -1)
- {
- mx.screens.Slide._gotoSlideNesting--;
- return false;
- }
- var _loc3_ = _loc10_;
- while(true)
- {
- _loc3_._currentSlide = null;
- _loc3_._currentChildSlide = null;
- if(!_loc3_.parentIsSlide)
- {
- break;
- }
- _loc3_ = _loc3_.parentSlide;
- }
- _loc3_ = newSlide;
- var _loc6_ = null;
- while(true)
- {
- _loc3_._currentSlide = newSlide;
- _loc3_._currentChildSlide = _loc6_;
- if(!_loc3_.parentIsSlide)
- {
- break;
- }
- _loc6_ = _loc3_;
- _loc3_ = _loc3_.parentSlide;
- }
- _loc2_.showSlide();
- while(_loc2_ != newSlide)
- {
- var _loc8_ = _loc2_.getChildSlide(_loc2_._childThatContainsGotoSlide);
- if(_loc8_ == null)
- {
- break;
- }
- if(_loc2_.overlayChildren)
- {
- _loc4_ = 0;
- while(_loc4_ < _loc2_._childThatContainsGotoSlide)
- {
- _loc2_._childSlides[_loc4_].showSlide();
- _loc4_ = _loc4_ + 1;
- }
- }
- _loc2_ = _loc8_;
- _loc2_.showSlide();
- }
- if(this.rootSlide.allAncestorsVisible())
- {
- if(mx.screens.Slide._inKeyDown)
- {
- this.doLater(newSlide,"setFocus");
- }
- else
- {
- newSlide.setFocus();
- }
- }
- _loc3_ = _loc10_;
- while(true)
- {
- _loc3_._currentSlide = null;
- _loc3_._currentChildSlide = null;
- _loc3_._childThatContainsGotoSlide = -1;
- if(!_loc3_.parentIsSlide)
- {
- break;
- }
- _loc3_ = _loc3_.parentSlide;
- }
- _loc3_ = newSlide;
- _loc6_ = null;
- while(true)
- {
- _loc3_._currentSlide = newSlide;
- _loc3_._currentChildSlide = _loc6_;
- _loc3_._childThatContainsGotoSlide = -1;
- if(!_loc3_.parentIsSlide)
- {
- break;
- }
- _loc6_ = _loc3_;
- _loc3_ = _loc3_.parentSlide;
- }
- mx.screens.Slide._gotoSlideNesting--;
- return true;
- }
- function doLaterGotoSlide()
- {
- this.gotoSlide(this._laterGotoSlide);
- }
- function init()
- {
- this._childSlides = [];
- this.doLater(this,"stop");
- super.init();
- this.tabEnabled = false;
- this.focusEnabled = true;
- this._visible = false;
- if(mx.screens.Slide._focusFixup == null)
- {
- mx.screens.Slide._focusFixup = new Object();
- mx.screens.Slide._focusFixup.onSetFocus = function(o, n)
- {
- mx.screens.Slide._focusSeq = mx.screens.Slide._focusSeq + 1;
- if(n != null && typeof n != "movieclip" && !n._isSlide)
- {
- mx.screens.Slide._disableArrowKeys = true;
- }
- else
- {
- mx.screens.Slide._disableArrowKeys = false;
- }
- };
- Selection.addListener(mx.screens.Slide._focusFixup);
- mx.screens.Slide._focusFixup.onKeyDown = function(Void)
- {
- var _loc1_ = {type:"keyDown",code:Key.getCode(),ascii:Key.getAscii(),shiftKey:Key.isDown(16),ctrlKey:Key.isDown(17)};
- mx.screens.Slide._inKeyDown = true;
- if(mx.screens.Slide.currentFocusedSlide.useDefaultKeyDownHandler())
- {
- mx.screens.Slide.currentFocusedSlide.callDefaultKeyDownHandler(_loc1_);
- }
- mx.screens.Slide._inKeyDown = false;
- };
- Key.addListener(mx.screens.Slide._focusFixup);
- }
- if(this._parent._name != this._parent._parent._childLoading)
- {
- if(!this.parentIsSlide)
- {
- this._defaultKeyDownHandler = this.autoKeyDownHandler;
- this.addEventListener("mouseDownSomewhere",this);
- this.doLater(this,"gotoFirstSlide");
- }
- else if(this.parentSlide && this.parentSlide._isSlide)
- {
- this.parentSlide.registerChildSlide(this);
- }
- }
- }
- function registerChildSlide(slide)
- {
- slide._indexInParentSlide = this._childSlides.push(slide) - 1;
- }
- function useDefaultKeyDownHandler()
- {
- var _loc2_ = this;
- while(_loc2_.parentIsSlide && _loc2_.autoKeyNav == "inherit")
- {
- _loc2_ = _loc2_.parentSlide;
- }
- var _loc3_ = undefined;
- _loc3_ = _loc2_.autoKeyNav == "true" || _loc2_.autoKeyNav == "inherit";
- return _loc3_;
- }
- function callDefaultKeyDownHandler(o)
- {
- var _loc2_ = this;
- while(_loc2_.parentIsSlide && _loc2_.defaultKeyDownHandler == null)
- {
- _loc2_ = _loc2_.parentSlide;
- }
- if(_loc2_.defaultKeyDownHandler)
- {
- _loc2_.defaultKeyDownHandler.call(_loc2_,o);
- }
- }
- function autoKeyDownHandler(o)
- {
- if(!mx.screens.Slide._disableArrowKeys)
- {
- switch(o.code)
- {
- case 32:
- if(this.getFocusManager().bDrawFocus)
- {
- break;
- }
- case 39:
- this.currentSlide.gotoNextSlide();
- break;
- case 37:
- this.currentSlide.gotoPreviousSlide();
- }
- }
- }
- function allTransitionsOutDone(o)
- {
- super.allTransitionsOutDone(o);
- if(this == this.currentSlide)
- {
- this.setFocus();
- }
- }
- function showSlide()
- {
- if(this._visible && this.__transitionManager.numOutTransitions > 0)
- {
- this._visible = false;
- this.__transitionManager.removeAllTransitions();
- this.__transitionManager.restoreContentAppearance();
- }
- this.visible = true;
- }
- function hideSlide()
- {
- if(this.__transitionManager.numTransitions > 0)
- {
- this.__transitionManager.removeAllTransitions();
- this.__transitionManager.restoreContentAppearance();
- }
- this.visible = false;
- }
- function doStop()
- {
- this.gotoAndStop(1);
- }
- function hideHandler(o)
- {
- if(!this.playHidden)
- {
- this.doLater(this,"doStop");
- }
- var _loc2_ = undefined;
- _loc2_ = this;
- while(_loc2_.parentIsSlide)
- {
- _loc2_ = _loc2_.parentSlide;
- _loc2_.dispatchEvent({type:"hideChild",target:this});
- }
- }
- function doPlay()
- {
- this._shown = true;
- this.play();
- }
- function revealHandler(o)
- {
- if(!this._shown || !this.playHidden)
- {
- this.doLater(this,"doPlay");
- }
- var _loc2_ = undefined;
- _loc2_ = this;
- while(_loc2_.parentIsSlide)
- {
- _loc2_ = _loc2_.parentSlide;
- _loc2_.dispatchEvent({type:"revealChild",target:this});
- }
- }
- function childLoaded(obj)
- {
- super.childLoaded(obj);
- var _loc5_ = {x:0,y:0};
- this.globalToLocal(_loc5_);
- obj.move(_loc5_.x,_loc5_.y);
- if(obj._containedScreen._isSlide)
- {
- var _loc4_ = obj._containedScreen;
- var _loc6_ = mx.screens.Slide(obj._parent);
- obj._isSlideContainer = true;
- obj._containedSlide = _loc4_;
- _loc4_._indexInParentSlide = _loc6_._childSlides.push(_loc4_) - 1;
- if(_loc6_.currentSlide)
- {
- this.doLater(_loc6_,"gotoFirstSlide");
- }
- }
- }
- function shouldHideDuringGoto()
- {
- if(this._childThatContainsGotoSlide != -1 || !this.parentIsSlide)
- {
- return false;
- }
- var _loc2_ = this.parentSlide;
- var _loc3_ = this.indexInParent;
- while(true)
- {
- if(_loc2_._childThatContainsGotoSlide != -1)
- {
- if(_loc3_ > _loc2_._childThatContainsGotoSlide)
- {
- return true;
- }
- if(_loc2_.overlayChildren)
- {
- return false;
- }
- return true;
- }
- if(!_loc2_.overlayChildren)
- {
- return true;
- }
- if(!_loc2_.parentIsSlide)
- {
- return false;
- }
- _loc3_ = _loc2_.indexInParent;
- _loc2_ = _loc2_.parentSlide;
- }
- return false;
- }
- function destroyChildAt(childIndex)
- {
- var _loc3_ = this.getChildSlide(childIndex);
- if(_loc3_ == this._currentChildSlide)
- {
- this.gotoSlide(this);
- }
- this._childSlides.splice(childIndex,1);
- super.destroyChildAt(childIndex);
- }
- function allAncestorsVisible()
- {
- var _loc2_ = this;
- while(_loc2_)
- {
- if(!_loc2_._visible)
- {
- return false;
- }
- _loc2_ = _loc2_._parent;
- }
- return true;
- }
- function isAncestor(a, o)
- {
- var _loc1_ = o;
- while(_loc1_ && _loc1_ != a)
- {
- _loc1_ = _loc1_._parent;
- }
- return _loc1_ == a;
- }
- function hasMouseHandler(o)
- {
- if(o.onPress != undefined || o.onRelease != undefined || o.onReleaseOutside != undefined || o.onDragOut != undefined || o.onDragOver != undefined || o.onRollOver != undefined || o.onRollOut != undefined || o.delegateClick != undefined || o.clickHandler != undefined)
- {
- return true;
- }
- return false;
- }
- function getMousedChild(x, y, o)
- {
- for(var _loc7_ in o)
- {
- var _loc2_ = o[_loc7_];
- if(_loc2_._parent == o)
- {
- if(_loc2_.hitTest(x,y,true))
- {
- if(this.hasMouseHandler(_loc2_))
- {
- return _loc2_;
- }
- var _loc3_ = this.getMousedChild(x,y,_loc2_);
- if(_loc3_ != undefined)
- {
- return _loc3_;
- }
- return _loc2_;
- }
- }
- }
- return undefined;
- }
- function mouseDownSomewhereHandler(o)
- {
- var _loc6_ = _root._xmouse;
- var _loc5_ = _root._ymouse;
- if(this != this.rootSlide)
- {
- return undefined;
- }
- if(this.allAncestorsVisible() && this.hitTest(_loc6_,_loc5_,false))
- {
- var _loc4_ = this.getMousedChild(_loc6_,_loc5_,this);
- var _loc7_ = this.getMousedChild(_loc6_,_loc5_,_root);
- var _loc3_ = null;
- if(_loc4_ == undefined && this.hitTest(_loc6_,_loc5_,true))
- {
- if(_loc7_ == this && !this.hasMouseHandler(this))
- {
- _loc3_ = this;
- }
- }
- else if(this.isAncestor(_loc7_,_loc4_) && !this.hasMouseHandler(_loc4_))
- {
- if(_loc4_._isSlide)
- {
- _loc3_ = _loc4_;
- }
- else
- {
- _loc3_ = _loc4_;
- while(_loc3_ && !_loc3_._isSlide)
- {
- _loc3_ = _loc3_._parent;
- }
- }
- }
- if(_loc3_ && _loc3_.allAncestorsVisible() && mx.screens.Slide.currentFocusedSlide.rootSlide != _loc3_.rootSlide)
- {
- mx.screens.Slide._focusSeq = mx.screens.Slide._focusSeq + 1;
- mx.screens.Slide._clickFocusSeq = mx.screens.Slide._focusSeq;
- this.doLater(_loc3_.rootSlide.currentSlide,"clickSetFocus");
- }
- }
- }
- function clickSetFocus()
- {
- if(mx.screens.Slide._focusSeq == mx.screens.Slide._clickFocusSeq)
- {
- this.doLater(this,"setFocus");
- }
- }
- }
-